/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dtd.gui;

import com.dtd.implementation.Analyzer;
import com.dtd.implementation.CustomParser;
import com.sun.xml.internal.ws.api.message.Message;
import java.awt.Color;
import java.awt.Cursor;
import java.util.Map;
import javax.swing.JOptionPane;

/**
 *
 * @author TQD
 */
public class CourseDetailForm extends javax.swing.JDialog {

    private static String idCourse = null;
    private static Map<String, String> mapDetail = null;
    private static Map<String, String> cookies = null;
    private static Analyzer analyer = null;

    /**
     * Creates new form CourseDetailForm
     */
    public CourseDetailForm(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo(null);
        this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        load();
        calculateMinGradeExam();
    }

    private void load() {
        cookies = CategoryForm.getCookies();
        idCourse = ((CategoryForm) this.getParent()).getIdCourse();
        analyer = new Analyzer();
        mapDetail = analyer.analyzerCourse(cookies, idCourse);
        

        lbCourse.setText(mapDetail.get("courseName").toString());
        txtQuiz.setText(mapDetail.get("quizAvg").toString());
        txtAssigment.setText(mapDetail.get("assigmentAvg").toString());

    }

    //Calculate min Final method
    private void calculateMinGradeExam() {
        String strQuiz = txtQuiz.getText();
        String strAssigment = txtAssigment.getText();
        String strQuizPercent = txtQuizPercent.getText();
        String strAssPercent = txtAssPercent.getText();
        String strFinalPercent = txtFinalPercent.getText();

        double quiz = CustomParser.parseDouble(strQuiz);
        quiz = CustomParser.round2Decimals(quiz);

        double assigment = CustomParser.parseDouble(strAssigment);
        assigment = CustomParser.round2Decimals(assigment);

        double quizPercent = CustomParser.parseDouble(strQuizPercent);
        quizPercent = CustomParser.round2Decimals(quizPercent);

        double assPercent = CustomParser.parseDouble(strAssPercent);
        assPercent = CustomParser.round2Decimals(assPercent);

        double finalPercent = CustomParser.parseDouble(strFinalPercent);
        finalPercent = CustomParser.round2Decimals(finalPercent);
        
        double min = ( 500 - quiz*quizPercent - assigment*assPercent ) / finalPercent;
        min = CustomParser.round2Decimals(min);
        if(min<4){
            min = 4;
        }
   
        txtFinal.setText(min+"");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lbCourse = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtAssigment = new javax.swing.JTextField();
        txtQuiz = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtFinal = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        btnBack = new javax.swing.JButton();
        txtQuizPercent = new javax.swing.JTextField();
        txtFinalPercent = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtAssPercent = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        lbAttendance = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setPreferredSize(new java.awt.Dimension(430, 340));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        lbCourse.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        lbCourse.setForeground(new java.awt.Color(51, 153, 255));
        lbCourse.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbCourse.setText("jLabel1");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("<html> AssigmentLab/<br>  Midterm Avg </html>");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("<html>Quizz Avg</html>");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("<html>MIN FINAL</html>");

        txtAssigment.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txtAssigment.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtAssigment.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtAssigmentCaretUpdate(evt);
            }
        });
        txtAssigment.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtAssigmentActionPerformed(evt);
            }
        });

        txtQuiz.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txtQuiz.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtQuiz.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtQuizCaretUpdate(evt);
            }
        });
        txtQuiz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtQuizActionPerformed(evt);
            }
        });

        jLabel2.setText("%");

        txtFinal.setEditable(false);
        txtFinal.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        txtFinal.setForeground(new java.awt.Color(255, 0, 0));
        txtFinal.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtFinal.setText("1.3");
        txtFinal.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
        txtFinal.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        txtFinal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtFinalActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel8.setText("*");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel9.setText("*");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel10.setText("*");

        btnBack.setText("BACK");
        btnBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBackActionPerformed(evt);
            }
        });

        txtQuizPercent.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtQuizPercent.setText("30");
        txtQuizPercent.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtQuizPercentCaretUpdate(evt);
            }
        });

        txtFinalPercent.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtFinalPercent.setText("40");
        txtFinalPercent.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtFinalPercentCaretUpdate(evt);
            }
        });

        jLabel6.setText("%");

        txtAssPercent.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtAssPercent.setText("30");
        txtAssPercent.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtAssPercentCaretUpdate(evt);
            }
        });
        txtAssPercent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtAssPercentActionPerformed(evt);
            }
        });

        jLabel7.setText("%");

        lbAttendance.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbAttendance.setText("Attendance");
        lbAttendance.setToolTipText("click to view attendance report");
        lbAttendance.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lbAttendanceMouseExited(evt);
            }
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbAttendanceMouseClicked(evt);
            }
        });
        lbAttendance.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                lbAttendanceMouseMoved(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbAttendance)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(txtQuizPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel2))
                                    .addComponent(txtQuiz, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(59, 59, 59)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(txtFinalPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel6))
                                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(lbCourse, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(40, 40, 40)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(btnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGap(17, 17, 17)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(21, 21, 21)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGap(13, 13, 13)
                                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(txtAssigment, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                            .addComponent(txtAssPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(lbCourse, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtQuiz, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtAssigment, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtAssPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel7))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtQuizPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtFinalPercent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))))
                .addGap(19, 19, 19)
                .addComponent(lbAttendance)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(22, Short.MAX_VALUE))
        );

        lbAttendance.getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtAssigmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAssigmentActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAssigmentActionPerformed

    private void txtQuizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtQuizActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtQuizActionPerformed

    private void txtFinalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtFinalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtFinalActionPerformed

    private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBackActionPerformed
        // TODO add your handling code here:
        this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        this.dispose();

    }//GEN-LAST:event_btnBackActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        this.getParent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }//GEN-LAST:event_formWindowClosing

    private void txtAssPercentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAssPercentActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAssPercentActionPerformed

    private void txtQuizCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtQuizCaretUpdate
        // TODO add your handling code here:
        calculateMinGradeExam();
    }//GEN-LAST:event_txtQuizCaretUpdate

    private void txtAssigmentCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtAssigmentCaretUpdate
        // TODO add your handling code here:
        calculateMinGradeExam();
    }//GEN-LAST:event_txtAssigmentCaretUpdate

    private void txtQuizPercentCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtQuizPercentCaretUpdate
        // TODO add your handling code here:
        calculateMinGradeExam();
    }//GEN-LAST:event_txtQuizPercentCaretUpdate

    private void txtFinalPercentCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtFinalPercentCaretUpdate
        // TODO add your handling code here:
        calculateMinGradeExam();
    }//GEN-LAST:event_txtFinalPercentCaretUpdate

    private void txtAssPercentCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtAssPercentCaretUpdate
        // TODO add your handling code here:
        calculateMinGradeExam();
    }//GEN-LAST:event_txtAssPercentCaretUpdate

    private void lbAttendanceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAttendanceMouseClicked
        // TODO add your handling code here:
        showAttendanceInfo();
    }//GEN-LAST:event_lbAttendanceMouseClicked

    private void lbAttendanceMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAttendanceMouseMoved
        // TODO add your handling code here:
        lbAttendance.setForeground(Color.BLUE);
    }//GEN-LAST:event_lbAttendanceMouseMoved

    private void lbAttendanceMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbAttendanceMouseExited
        // TODO add your handling code here:
        lbAttendance.setForeground(Color.BLACK);
    }//GEN-LAST:event_lbAttendanceMouseExited
    
    //lấy thông tin attendance từ analyzer
    public void showAttendanceInfo(){
        Map<Integer, String> attDetails = null;
        attDetails = analyer.analyzerAttendance(cookies, idCourse);
        String attInfo = "Number of Sessions: " + attDetails.get(0) + " \n"
                + "Sessions Completed: " + attDetails.get(1) + " \n"
                + "Present: " + attDetails.get(2) + " \n"
                + "Absent: " + attDetails.get(3) + " \n"
                + "Attendance percent: " + attDetails.get(4) + " \n"
                + "Attendance grade: "+ attDetails.get(5);
        infoBox(attInfo,"Attendance");
    }
    
    public static void infoBox(String infoMessage, String location)
    {
        JOptionPane.showMessageDialog(null, infoMessage,  location, JOptionPane.INFORMATION_MESSAGE);
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CourseDetailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CourseDetailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CourseDetailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CourseDetailForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                CourseDetailForm dialog = new CourseDetailForm(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBack;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel lbAttendance;
    private javax.swing.JLabel lbCourse;
    private javax.swing.JTextField txtAssPercent;
    private javax.swing.JTextField txtAssigment;
    private javax.swing.JTextField txtFinal;
    private javax.swing.JTextField txtFinalPercent;
    private javax.swing.JTextField txtQuiz;
    private javax.swing.JTextField txtQuizPercent;
    // End of variables declaration//GEN-END:variables
}
